import { GSprite } from "../../../../com/mui/controls/GSprite";
import { ObjCreate } from "./ObjCreate";
import { GlobalClass } from "../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../resource/ImagesConst";
import { ScaleBitmap } from "../../../../com/mui/display/ScaleBitmap";
type int = number;
//class FlowerBg
    
    export  class FlowerBg extends GSprite
    {
        constructor(arg1: int, arg2: int, arg3: Boolean=true, arg4: string="LT,LB,RT,RB")
        {
            super();
            this._bwidth = arg1;
            this._bheight = arg2;
            this._bbg = arg3;
            this._parts = arg4;
            this.mouseEnabled = false;
            return;
        }

        protected /* override */ createDisposedChildrenImpl(): void
        {
            super.createDisposedChildren();
            this.init(this._bbg, this._parts);
            return;
        }

        protected /* override */ disposeImpl(arg1: Boolean=true): void
        {
            if (arg1) 
            {
                if (this._bg) 
                {
                    this._bg.dispose();
                }
                ObjCreate.disposeBitmap(this._ltBitmap);
                ObjCreate.disposeBitmap(this._lbBitmap);
                ObjCreate.disposeBitmap(this._rtBitmap);
                ObjCreate.disposeBitmap(this._rbBitmap);
                this._bg = null;
                this._ltBitmap = null;
                this._lbBitmap = null;
                this._rtBitmap = null;
                this._rbBitmap = null;
            }
            super.disposeImpl(arg1);
            return;
        }

        /* internal  */init(arg1: Boolean=true, arg2: string="LT,LB,RT,RB"): void
        {
            var loc1=null;
            if (arg1) 
            {
                this._bg = ObjCreate.createBg(0, 0, this._bwidth, this._bheight, this);
            }
            loc1 = GlobalClass.getBitmapData(ImagesConst.RechargeSmallBg);
            arg2 = arg2.toLocaleUpperCase();
            if (arg2.indexOf("RT") != -1) 
            {
                this._rtBitmap = new Object /* flash.display.Bitmap */(loc1);
                this.addChild(this._rtBitmap);
            }
            if (arg2.indexOf("RB") != -1) 
            {
                this._rbBitmap = new Object /* flash.display.Bitmap */(loc1);
                this._rbBitmap.scaleY = -1;
                this.addChild(this._rbBitmap);
            }
            if (arg2.indexOf("LT") != -1) 
            {
                this._ltBitmap = new Object /* flash.display.Bitmap */(loc1);
                this._ltBitmap.scaleX = -1;
                this.addChild(this._ltBitmap);
            }
            if (arg2.indexOf("LB") != -1) 
            {
                this._lbBitmap = new Object /* flash.display.Bitmap */(loc1);
                this._lbBitmap.scaleX = -1;
                this._lbBitmap.scaleY = -1;
                this.addChild(this._lbBitmap);
            }
            this.resize();
            return;
        }

        /* internal  */resize(): void
        {
            if (this._bg) 
            {
                this._bg.width = this._bwidth;
                this._bg.height = this._bheight;
            }
            if (this._ltBitmap) 
            {
                this._ltBitmap.x = this._ltBitmap.width + 1;
                this._ltBitmap.y = 1;
            }
            if (this._rtBitmap) 
            {
                this._rtBitmap.x = (this._bwidth - this._rtBitmap.width - 1);
                this._rtBitmap.y = 1;
            }
            if (this._lbBitmap) 
            {
                this._lbBitmap.x = this._lbBitmap.width + 1;
                this._lbBitmap.y = (this._bheight - 1);
            }
            if (this._rbBitmap) 
            {
                this._rbBitmap.x = (this._bwidth - this._rbBitmap.width - 1);
                this._rbBitmap.y = (this._bheight - 1);
            }
            return;
        }

        public get bwidth(): int
        {
            return this._bwidth;
        }

        public set bwidth(arg1: int)
        {
            this._bwidth = arg1;
            this.resize();
            return;
        }

        public get bheight(): int
        {
            return this._bheight;
        }

        public set bheight(arg1: int)
        {
            this._bheight = arg1;
            this.resize();
            return;
        }

        /* internal */ /* var */_bg: ScaleBitmap;

        /* internal */ /* var */_ltBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_lbBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_rtBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_rbBitmap: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_bwidth: int;

        /* internal */ /* var */_bheight: int;

        /* internal */ /* var */_bbg: Boolean;

        /* internal */ /* var */_parts: string;
    }
